import { Navigate } from "react-router-dom";
import { getToken } from "../utils/auth";

interface children {
  children: any
}

const PrivateRoute = ({ children }: children) => {

  const token = getToken(); 
  return token ? children : <Navigate to="/login" replace />;
};

export default PrivateRoute;